package it.cst.util;

import java.util.Comparator;


public class UserStatComparator implements Comparator<UserStat>
{
    public int compare(UserStat us1,UserStat us2)
    {
        if (us1.getPercMatchWin() < us2.getPercMatchWin())
            return 1;
        else if (us1.getPercMatchWin() == us2.getPercMatchWin())
        {
        	if(us1.getPercMatchLoose() > us2.getPercMatchLoose())
        		return 1;
        	else if(us1.getPercMatchLoose() == us2.getPercMatchLoose()){
        		if (us1.getTotMatch() < us2.getTotMatch())
        			return 1;
        		else if (us1.getTotMatch() == us2.getTotMatch())
        			return 0;
        		else
        			return -1;
        	}
        	else
        		return -1;
        } 
        else
            return -1;
    }
}